import Button from "components/Base/Button";
import Icon from "components/Base/Icon";
import DataTable from "components/Base/DataTable";
import Image from "components/Base/Image";
import {drpStateDict} from "../../../../models/DrpState";

export default (self) => [

  {
    title: 'id',
    name: 'id',
    formItem: {
      type: 'hidden',
    }
  },

  {
    title: '分销商头像',
    name: 'davatarUrl',
    tableItem: {
      render: (text, record) => {
        return <Image src={text} style={{width: 50, height: 50}}/>
      }
    },
  },

  {
    title: '分销商',
    name: 'user',
    tableItem: {
      render: (text, record) => {
        return (
          <DataTable.Oper>
            <a onClick={e => {
              self.props.showUserDrp(record.duserId);
            }}>
              <span>{record.user}</span>
            </a>
          </DataTable.Oper>
        );
      }
    },
  },

  {
    title: "子用户",
    name: 'child',
    tableItem: {},
  },

  {
    title: '状态',
    name: 'drpState',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请选择状态'
        }
      ],

      showSearch: true,
      type: 'select',
    },
    dict: drpStateDict,
  },

  {
    title: "提交时间",
    name: 'createTime',
    tableItem: {},
  },

  {
    title: '操作',
    tableItem: {
      width: 180,
      align: 'center',
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit"/>
          </Button>
          {/*<Button tooltip="删除" onClick={e => self.onDelete(record)}>*/}
          {/*  <Icon type="trash"/>*/}
          {/*</Button>*/}
        </DataTable.Oper>
      )
    }
  }
]
